﻿using AccessControl.Sida.Business;
using AccessControl.Sida.Common;
using AccessControl.Sida.StudentCardPrint.Report;
using AccessControl.Utility.Report;


namespace AccessControl.Sida.StudentCardPrint.ReportBuilder
{
	public partial class TextReportBuilderStudentCard : TextReportBuilder
	{

		private readonly StudentCardBusiness _studentCardBusiness = new StudentCardBusiness();
    	private readonly string[] _stcodeArray;

		public TextReportBuilderStudentCard(string[] stcodeArray)
			: base(false)
        {
			_stcodeArray = stcodeArray;
            InitializeComponent();
			
        }

		protected override void CreateTextReport()
		{
			var sidaDS = new SidaDS();

			var studnetCardTable = _studentCardBusiness.SelectStudentCardArray(_stcodeArray);
			if (studnetCardTable != null)
			{
				sidaDS.StudentCard.Merge(studnetCardTable);
			}

			Report = new StudentCardReport(sidaDS);

			base.CreateTextReport();
		}
	}
}
